#ifndef RENDER_H
#define RENDER_H

class Scene;
class Mask;

#define AIR_REFRACTION_INDEX 1.0003

#include "src/scene/color.h"
#include "src/scene/ray.h"

class Render {
    public:
        Render(Scene *_s, unsigned int _d = 1) : scene(_s), depth(_d) {};
        virtual ~Render() {};

        void calculateLine(unsigned char **, unsigned int, unsigned int, unsigned int, unsigned int, Mask *, bool = false);

        void setDepth(unsigned int _d) {depth = _d;};
        const unsigned int &getDepth() const {return depth;};

    protected:
        Scene *scene;
        unsigned int depth;

        virtual Color calculate(const Ray &, unsigned int, bool = false) const = 0;


        Ray reflectedRay(const Vector3D &, const Vector3D &,const Vector3D &, Object * = NULL) const;
        Color findReflectionColor(const Vector3D &, const Vector3D &, const Vector3D &, unsigned int, Object * = NULL, bool = false) const;

        Ray transmittedRay(const Vector3D &, const Vector3D &, const Vector3D &, double, double, bool *, Object * = NULL) const;
        Color findTransmittionColor(const Vector3D &, const Vector3D &, const Vector3D &, double, double, unsigned int, Object * = NULL, bool = false) const;

        Ray diffusedRay(Object *, const Vector3D &, const Vector3D &, const Vector3D &, Object * = NULL) const;
        double findReflectance(const Vector3D &, const Vector3D &, double, double) const;

        Object *findN1N2(double *, double *, Object *, Object *) const;
};

#endif
